<?php
class CommonController extends Controller{

	public function __Init(){
		if(!defined('__TEMPLATE__')){
			//定义模板文件目录
			define('__TEMPLATE__',__ROOT__.'/Template/'.C('INDEX_TPL_STYLE'));
		}
		$this->category();
	}
	public function dis($tpl){
		$this->display('Template/'.C('INDEX_TPL_STYLE').'/'.$tpl);
	}
	public function category(){
		    	//显示分类
    	$topCate = M('category')->where("pid = 0")->limit(13)->all();
		foreach($topCate as $k => $v){
			$topCate[$k]['first'] = M('category')->where("pid={$v['cid']}")->limit(3)->all();
			$topCate[$k]['second'] = M('category')->where("pid={$v['cid']}")->all();
			foreach($topCate[$k]['second'] as $key => $val){
				$topCate[$k]['second'][$key]['three'] = M('category')->where("pid ={$val['cid']}")->limit(8)->all();	
			}
		}		
		$this->assign('topCate',$topCate);
	}
}
